package com.cortex.pineapple.adapters;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import com.cortex.pineapple.R;
import com.cortext.pineapple.link.ImageLink;
import com.cortext.pineapple.link.Link;
import com.cortext.pineapple.link.VideoLink;
import com.squareup.picasso.Callback;
import com.squareup.picasso.Picasso;
import com.squareup.picasso.RequestCreator;


import android.content.Context;
import android.graphics.Bitmap;
import android.media.ThumbnailUtils;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.AbsListView;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

public class ImageAdapter extends LinkAdapter<ImageLink> {

	public ImageAdapter(Context context){
		super(context);
		links = new ArrayList<ImageLink>();
	}
	public ImageAdapter(Context context,List<ImageLink> links){
		super(context,links);
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ImageLink link = links.get(position);
		ImageView linkView = (ImageView) convertView; 
		if(linkView == null){
			LayoutInflater inflater = LayoutInflater.from(context);
			linkView = (ImageView) inflater.inflate(R.layout.view_image_link, null);
		}
		Picasso.with(context)
		.load(link.getImageUrl())
		.resizeDimen(R.dimen.imageCellWidth, R.dimen.imageCellHeight)
		.noFade()
		.into(linkView);
		return linkView;
	}
	@Override
	protected void buildItemView(ImageLink link, ViewGroup linkView) {
		
	}
}

